﻿using System.Windows;
using System.Windows.Controls;
using MetroEventToCommand;

namespace TestApp
{
    public partial class MainPage
    {
        public Command Test1Command { get; set; }

        public Command<string> Test2Command { get; set; }

        public Command<EventParameter<string>> Test3Command { get; set; }

        public Command<EventParameter<int>> Test4Command { get; set; }

        public EventParameter<string> EventParam { get; set; }

        public string SimpleParam { get; set; }

        // Constructor
        public MainPage()
        {
            InitializeComponent();

            this.InitializeComponent();

            SimpleParam = "Hello";

            Test1Command = new Command(() => Test1PassedTB.Visibility = Visibility.Visible);

            Test2Command = new Command<string>((param) =>
            {
                if (param == "Hello")
                    Test2PassedTB.Visibility = Visibility.Visible;
                else
                    Test2FailedTB.Visibility = Visibility.Visible;
            });

            Test3Command = new Command<EventParameter<string>>((param) =>
            {
                if ((param.Sender is Button) && (param.Parameter == "Hello"))
                    Test3PassedTB.Visibility = Visibility.Visible;
                else
                {
                    Test3FailedTB.Visibility = Visibility.Visible;
                }
            });

            Test4Command = new Command<EventParameter<int>>((param) =>
            {
                if ((param.Sender is Button) && (param.Parameter == 111))
                    Test4PassedTB.Visibility = Visibility.Visible;
                else
                {
                    Test4PassedTB.Visibility = Visibility.Visible;
                }
            });

            DataContext = this;
        }


    }
}